import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/home/Home.vue";

Vue.use(VueRouter);
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};
const routes = [
  {
    path: "/",
    redirect: "home",
    component: Home,
  },
  {
    path: "/home",
    component: Home,
  },
  {
    path: "/classify",
    component: () => import("@/views/classify/Classify"),
  },
  {
    path: "/cart",
    component: () => import("@/views/cart/Cart"),
  },
  {
    path: "/my",
    component: () => import("@/views/my/My"),
  },
  {
    path: "/detail/:id",
    component: () => import("@/views/detail/Detail"),
  },
];

const router = new VueRouter({
  routes,
});

export default router;
